﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreeWorkflow.DataModels;
using Microsoft.AspNet.Identity.EntityFramework;

namespace FreeWorkflow.DataAccess
{
    public class FreeWorkflowDatabaseContext : IdentityDbContext <IdentityUser>
    {
        public FreeWorkflowDatabaseContext()
            : base("FWF_Config")
        {

        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<IdentityUser>().ToTable("Users", "fwf").Property(p => p.Id).HasColumnName("UserId");
            modelBuilder.Entity<IdentityRole>().ToTable("Roles", "fwf").Property(p => p.Id).HasColumnName("RoleId");
            modelBuilder.Entity<IdentityUserRole>().ToTable("UserRoles", "fwf");
            modelBuilder.Entity<IdentityUserLogin>().ToTable("UserLogin", "fwf");
            modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaim", "fwf");

            modelBuilder.Entity<FreeWorkflow.DataModels.WorkItem>().ToTable("WorkItem", "fwf");

        }
        public virtual DbSet<FreeWorkflow.DataModels.WorkItem> WorkItems { get; set; }
    }
}
